/*****************************************************\
* Copyright (c) 2020 The game2d Authors. All rights reserved.
  Use of this source code is governed by a BSD-style license that can be
  found in the LICENSE file.

* Author:         dzlua - https://gitee.com/dzlua/game2d.git
* Email:          505544956@qq.com
* FileName:       ctrls/ui.h
* Create Time:    2020/03/22 15:21:04
* Description:    /
\****************************************************/
#ifndef __GAME2D_CTRLS_UI_H__
#define __GAME2D_CTRLS_UI_H__

#include "layout.h"

namespace g2d {
namespace ctrl {
  class UserInterface : public GameObject {
    public:
      UserInterface(bool load_res_on_enter) : GameObject(load_res_on_enter), root_(0) {}
      virtual ~UserInterface() { if (root_) root_->decref(); }
    public:
      virtual void set_root(Layout *layout);
      virtual Layout* root() const;
    public:
      virtual void update(Input &inp, Audio &aud) override;
      virtual void render(Renderer &r) override;
    protected:
      Layout *root_;
  };
} // end namespace ctrl
} // end namespace g2d

#endif // __GAME2D_CTRLS_UI_H__